//
//  ContentView.swift
//  BMort_SwiftUI
//
//  Created by anscen on 2022/9/1.
//

import SwiftUI
public enum BTabs:Int{
    case tab1 = 0
    case tab2 = 1
    case tab3 = 2
    case tab4 = 3
}
struct ContentView: View {
    @State private var tab  :BTabs  = .tab1
    private var listTitle :[String] = ["公积金贷款","商业贷款","组合贷款","我的"]
    func title(_ tab :BTabs) ->String{
        return self.listTitle[tab.rawValue]
    }
    var body: some View {
        NavigationView {
            TabView(selection:  $tab) {
                BGjjContentView().tabItem {
                    Image(tab == .tab1 ? "icon_tabbar_found_h" : "icon_tabbar_found_n")
                    Text(title(.tab1))
                }.tag(BTabs.tab1)
                BSyContentView().tabItem {
                    Image(tab == .tab2 ? "icon_tabbar_home_h" : "icon_tabbar_home_n")
                    Text(title(.tab2))
                }.tag(BTabs.tab2)
                BGroupContentView().tabItem {
                    Image(tab == .tab3 ? "icon_tabbar_video_h" : "icon_tabbar_video_n")
                    Text(title(.tab3))
                }.tag(BTabs.tab3)
                BMyContentView().tabItem {
                    Image(tab == .tab4 ? "icon_tabbar_wall_h" : "icon_tabbar_wall_n")
                    Text(title(.tab4))
                }.tag(BTabs.tab4)
            }.accentColor(Color.appColor()).navigationBarTitle(title(tab)).navigationBarTitleDisplayMode(.inline) .navigationViewStyle(.stack)
        }
    }
}
